# client.py
import requests


def test_client():
    response = requests.post(
        "http://localhost:8000/generate",
        json={"prompt": "Once upon a time", "max_tokens": 50}
    )

    if response.status_code == 200:
        result = response.json()
        print(f"Generated text: {result['text']}")
    else:
        print(f"Error: {response.text}")


if __name__ == "__main__":
    test_client()